package com.cssw.fyzb.busi.api.live;

import com.cssw.fyzb.busi.api.user.GetUserInfo;
import com.cssw.fyzb.busi.service.live.AnchorService;
import com.cssw.fyzb.busi.service.user.UserService;
import com.ydn.appserver.Action;
import com.ydn.appserver.Request;
import com.ydn.appserver.Response;
import com.ydn.appserver.annotations.Function;
import com.ydn.appserver.annotations.Parameter;
import com.ydn.appserver.annotations.Type;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 通过主播id获取主播信息
 *
 * @author YangYiQun
 */
@Function(description = "通过主播id获取主播信息", parameters = {
        @Parameter(name = "anchorId", type = Type.String, description = "主播id", required = true)
})
@Component
public class QueryAnchorById implements Action {

    @Autowired
    AnchorService anchorService;

    private static final Logger logger = LoggerFactory.getLogger(GetUserInfo.class);

    @Override
    public Response execute(Request request) throws Exception {
        Long anchorId = request.getLong("anchorId");
        return Response.success().put("data", anchorService.queryAnchorById(anchorId));
    }
}
